package cn.yangliu.config;

//import it.sauronsoftware.ftp4j.FTPClient;

import java.io.File;

/**
 * Created by mechrevo
 * on 2017/3/23 0023.
 */
public class FTP4JUtils {

  /*  public static FTPClient getClient(String host,int port,String username,String password) {
        try {
            FTPClient client=new FTPClient();
            client.connect(host,port);
            client.login(username,password);
            return client;
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(),e);
        }
    }

    private static void closeClient(FTPClient client){
        try {
            if (client!=null){
                client.disconnect(true);
            }
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(),e);
        }
    }

    public static void upload(FTPClient client,String pathname,String path){
        try {
            client.changeDirectory(path);
            client.upload(new File(pathname));
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(),e);
        }finally {
            closeClient(client);
        }

    }

    public static void download(FTPClient client,String remoteFileName,String savePathName){
        try {
            client.download(remoteFileName, new File(savePathName));
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(),e);
        }finally {
            closeClient(client);
        }
    }*/


}
